package com.woniu.model;

import org.springframework.stereotype.Component;

@Component
public class RedisKey {

    /*
    goodsId的锁
     */
    public static String goodsIdLock(String goodsId){
        return "lock:goodsId"+goodsId;
    }
    /*
   返回某用户购物车中某商品信息的key
    */
    public static String shoppingInfo(Integer userId,Integer goodsId){
        return "shoppingInfo:userId:"+userId+":goodsId" +goodsId;


    }
    /*
    返回某用户购物车列表的key
    */
    public static String userShopping(Integer userId) {
        return "user:shopping:userId" + userId;
    }







    /*
  用户手机号的锁
   */
    public static String phoneLock(String phone) {
        return "lock:phone:" + phone;
    }

    /*
       用户用户名的锁
        */
    public static String userNameLock(String userName) {
        return "lock:userName:" + userName;
    }

    /**
     * 返回用户验证码错误的总次数的key
     */
    public static String codeErrorNumber(String mobile) {
        return "code:error:number:mobile:" + mobile;
    }

    /*
  返回注册验证码在redis中的key
   */
    public static String registerCodeKey(String mobile) {
        return "register:code:mobile:" + mobile;
    }

    /*
        返回修改手机号验证码在redis中的key
       */
    public static String updateCodeKey(String mobile) {
        return "update:code:mobile:" + mobile;
    }

    /**
     * 场馆入驻申请，场馆id锁
     *
     * @param venueId
     * @return
     */
    public static String venueQualificationVenueIdLock(Integer venueId) {
        return "venue:qualification:id:lock:code:" + venueId;
    }

    /**
     * 场馆入驻申请,状态修改id锁
     *
     * @param certifyId
     * @return
     */
    public static String venueQualificationUpdateLock(Integer certifyId) {
        return "venue:qualification:update:lock:code:" + certifyId;
    }

    /*
     返回注册业务在一分钟内是否向某手机发送验证码的标识的key
    */
    public static String registerCodeOnMinute(String mobile) {
        return "register:code:minute:mobile:" + mobile;
    }

    /*
   返回修改业务在一分钟内是否向某手机发送验证码的标识的key
  */
    public static String updateCodeOnMinute(String mobile) {
        return "update:code:minute:mobile:" + mobile;
    }

    /*
    返回某手机号码在注册一小时内发送的短息总次数
    */
    public static String sendMessageNumber(String mobile) {
        return "send:message:number:mobile" + mobile;
    }

    /*
    返回某手机号码在修改一小时内发送的短息总次数
    */
    public static String updateMessageNumber(String mobile) {
        return "update:message:number:mobile" + mobile;
    }


    //登录业务验证码一分钟以内的key
    public static String loginCodeOnMinuteKey(String mobile) {
        return "login:code:minute:mobile:" + mobile;
    }

    //登录业务验证码的key
    public static String loginCodeKey(String mobile) {
        return "login:code:mobile:" + mobile;
    }

    /**
     * 教练入驻申请,状态修改id锁
     *
     * @param coachId
     * @return
     */
    public static String coachEnterUpdateLock(Integer coachId) {

        return "coach:enter:update:lock:code:" + coachId;
    }

    /**
     * 教室新增，场馆id锁
     * @param venueId
     * @return
     */
    public static String addClassroomVenueIdLock(Integer venueId) {

        return "add:classroom:venue:id:lock:code:" + venueId;
    }

    /**
     * 招聘信息新增，场馆id锁
     * @param venueId
     * @return
     */
    public static String addRecruitVenueIdLock(Integer venueId) {

        return "add:recruit:venue:id:lock:code:" + venueId;
    }

    /**
     * 用户购买团课，下单锁 团课锁
     * @param leagueClassId
     * @return
     */
    public static String orderLeagueClassClassId(Integer leagueClassId) {

        return "order:league:class:lock:class:code:"+leagueClassId;
    }
    /**
     * 用户购买团课，下单锁 用户id锁
     * @param userid
     * @return
     */
    public static String orderLeagueClassUserId(Integer userid) {

        return "order:league:class:lock:user:code:"+userid;
    }

    /**
     * 团课排班，团课课程id锁
     * @param classId
     * @return
     */
    public static String leagueClassWorkforceClassIdLock(Integer classId) {
        return "league:class:workforce:lock:class:id:code:"+classId;
    }

    /**
     * 用户购买私教课，下单锁 私教id锁
     * @param classId
     * @return
     */
    public static String orderPersonalClassClassId(Integer classId) {

        return "order:personal:class:lock:class:code:"+classId;
    }
}
